import request from '@/utils/axios/axios-service.ts'

/**
 * 邀请配置
 */
export const inviteConfigList = (params: any) => request.get('/config/invite/list', {params: params})
export const inviteConfigInfo = (id: number) => request.get('/config/invite/info/' + id)
export const inviteConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/config/invite/create' : '/config/invite/update', params)

/**
 * 意见反馈配置
 */
export const adviseConfigList = (params: any) => request.get('/config/user_advise/list', {params: params})
export const adviseConfigInfo = (id: number) => request.get('/config/user_advise/info/' + id)
export const adviseConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/config/user_advise/create' : '/config/user_advise/update', params)

/**
 * 特殊配置
 */
export const specialConfigList = (params: any) => request.get('/config/special/list', {params: params})
export const specialConfigInfo = (id: number) => request.get('/config/special/info/' + id)
export const specialConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/config/special/create' : '/config/special/update', params)
export const specialConfigDelete = (id: number) => request.post('/config/special/delete/' + id)

/**
 * 特殊规则配置
 */
export const specialRuleConfigList = (params: any) => request.get('/config/special_rule/list', {params: params})
export const specialRuleConfigInfo = (id: number) => request.get('/config/special_rule/info/' + id)
export const specialRuleConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/config/special_rule/create' : '/config/special_rule/update', params)
export const specialRuleConfigDelete = (id: number) => request.post('/config/special_rule/delete/' + id)

/**
 * 用户级别配置
 */
export const userLevelConfigList = (params: any) => request.get('/config/user_level/list', {params: params})
export const userLevelConfigInfo = (id: number) => request.get('/config/user_level/info/' + id)
export const userLevelConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/config/user_level/create' : '/config/user_level/update', params)

/**
 * Vip级别配置
 */
export const vipLevelConfigList = (params: any) => request.get('/config/vip_level/list', {params: params})
export const vipLevelConfigInfo = (id: number) => request.get('/config/vip_level/info/' + id)
export const vipLevelConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/config/vip_level/create' : '/config/vip_level/update', params)

/**
 * 私域级别配置
 */
export const privateLevelConfigList = (params: any) => request.get('/config/private_level/list', {params: params})
export const privateLevelConfigInfo = (id: number) => request.get('/config/private_level/info/' + id)
export const privateLevelConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/config/private_level/create' : '/config/private_level/update', params)

/**
 * 私域拿货价配置
 */
export const privatePriceCostConfigList = (params: any) => request.get('/config/private_price_cost/list', {params: params})
export const privatePriceCostConfigInfo = (id: number) => request.get('/config/private_price_cost/info/' + id)
export const privatePriceCostConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/config/private_price_cost/create' : '/config/private_price_cost/update', params)
export const privatePriceCostConfigs = () => request.get('/config/private_price_cost/configs')


export type InviteConfig = {
  id: number;
  type: number;
  name: string;
  prefix: string;
  backgrounds: string;
  order_num: number;
  enabled: boolean;
  create_by: number;
  create_user: string;
  update_by?: number;
  update_user?: string;
};

export type AdviseConfig = {
  id: number;
  name: string;
  order_num: number;
  enabled: boolean;
};

export type SpecialConfig = {
  id: number;
  name: string;
  key: string;
  image_url?: string;
  jump_type: number;
  jump_content: string | undefined;
  jump_params: string;
  order_num: number;
  enabled: boolean;
  deleted: boolean;
  create_by: number;
  create_user: string;
  update_by?: number;
  update_user?: string;
};

export type SpecialRuleConfig = {
  id: number;
  name: string;
  key: string;
  type: number;
  title: string;
  content: string;
  tip_msg: string;
  enabled: boolean;
  deleted: boolean;
  create_by: number;
  create_user: string;
  update_by?: number;
  update_user?: string;
};

export type UserLevelConfig = {
  id: number;
  name: string;
  level: number;
  icon: string;
  icon2: string;
  background: string;
  conditions: string;
  conditions2: string;
  bonus_ratio: number;
  bonus_ratio_store: number;
  bonus_ratio_withdraw: number;
  price: number;
  reward: number;
  contribution: number;
  coupon_id?: number;
  coupon_id2?: number;
  software_repeat_qty: number;
  software_price: number;
  software_count: number;
  open_upgrade: boolean;
  directly_count: number;
  team_consume: number;
  upgrade_rights: string;
};

export type VipLevelConfig = {
  id: number;
  name: string;
  level: number;
  icon: string;
  background: string;
  directly_count: number;
  reward: number;
  bonus_ratio: number;
  bonus_ratio_withdraw: number;
};

export type PrivateLevelConfig = {
  id: number;
  name: string;
  level: number;
  icon: string;
  icon2: string;
  upgradeable: boolean;
  team_count: number;
  price_cost: number;
};

export type PrivatePriceCostConfig = {
  id: number;
  name: string;
  price: number;
  price_cost_def: number;
  price_cost_corp: number;
  price_cost_level0: number;
  price_cost_level1: number;
  price_cost_level2: number;
  price_cost_level3: number;
  price_cost_level4: number;
  diff_reward1: number;
  diff_reward2: number;
  diff_reward3: number;
};



